class Dog():
    """一次模拟小狗的类尝试"""
    def __init__(self, name, age):
        """初始化类的属性， 类中的函数称为方法，__init__ 是一个约定"""
        """俗称的初始化方法，以方便区分普通方法， 必须包含self的行参"""
        self.name = name
        self.age = age

    def sit (self):
        """ 模拟小狗蹲下的命令 """
        print(self)
        print(self.name.title() + 'is now setting')

    def roll(self):
        """模拟小狗打滚的命令"""
        print(self.name.title() + 'rolled over!')

# 实例化类

my_dog = Dog('willie', 6)

print("My dog's name " + my_dog.name.title() + '!')
print("My dog's " + str(my_dog.age) + ' years old.')
my_dog.sit()
my_dog.roll()